#ifndef Z_MEMORY_H_
#define Z_MEMORY_H_

#include <stdio.h>
#include <stdlib.h>

void z_debug();

void *_z_malloc(size_t __size, const char *file, int line, const char *func);

void *_z_calloc(size_t __nmemb, size_t __size, const char *file, int line, const char *func);

void *_z_realloc(void *__ptr, size_t __size, const char *file, int line, const char *func);

void _z_free(void *__ptr, const char *file, int line, const char *func);

#ifdef __arm__
#define z_malloc malloc
#define z_calloc calloc
#define z_realloc realloc
#define z_free free
#define z_cfree cfree
#else
#define z_malloc(__size) _z_malloc(__size, __FILE__, __LINE__, __FUNCTION__)
#define z_calloc(__nmemb, __size) _z_calloc(__nmemb, __size, __FILE__, __LINE__, __FUNCTION__)
#define z_realloc(__ptr, __size) _z_realloc(__ptr, __size, __FILE__, __LINE__, __FUNCTION__)
#define z_free(__ptr) _z_free(__ptr, __FILE__, __LINE__, __FUNCTION__)
#endif

#endif /* Z_MEMORY_H_ */
